package cst.a921sxh.zyfypt_921sxh;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;


public class Fragment41 extends Fragment {
    private RecyclerView recyclerView;
    private TcaseAdapter adapter;
    private List<TcaseBean> list;
    private RecyclerView.LayoutManager layoutManager;
    private sxhListener<List<TcaseBean>> listener;
    private ResModel model;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_41,container,false);
        recyclerView=(RecyclerView)view.findViewById(R.id.tcase_rec);
        adapter=new TcaseAdapter(getActivity());
        list=new ArrayList<TcaseBean>();
        layoutManager=new LinearLayoutManager(getActivity());
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setAdapter(adapter);
        listener=new sxhListener<List<TcaseBean>>() {
            @Override
            public void onResponse(List<TcaseBean> l) {
                adapter.setList(l);
            }

            @Override
            public void onFail(String msg) {

            }
        };
        model=new ResModel("gson");
        model.getList("tcase",1,listener);
        return view;
    }

}
